package com.yit.test.demo;

import com.yit.test.demo.Entity.OrderInfo;
import org.springframework.test.util.ReflectionTestUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import static org.testng.Assert.*;

/**
 * Created by zhangyanfei on 2017/8/31.
 *
 * @author zhangyanfei
 * @date 2017/08/31
 */
public class OrderServiceTestWithTestNG {
    private OrderService orderService;
    private ProductService productService;
    private PriceService priceService;
    @BeforeMethod
    public void setUp() throws Exception {
        orderService=new OrderService();
        productService=new ProductService();
        priceService=new PriceService();
        ReflectionTestUtils.setField(orderService,"productService",productService);
        ReflectionTestUtils.setField(orderService,"priceService",priceService);
    }

    @Test
    public void testGetOrderInfoByOrderCode() throws Exception {
        OrderInfo orderInfo=orderService.getOrderInfoByOrderCode("testCode");
        Assert.assertNotNull(orderInfo);
    }

}